<template>
  <div class="chartBarComment"></div>
</template>
<script>
export default {
  name: "chartBarComment",
  props: {},
  data() {
    return {
      myChart: null,
    };
  },
  methods: {
    draw() {
      const param = {
        user_id: JSON.parse(window.sessionStorage.getItem("userInfo")).id,
      };
      this.$axios
        .get("/article/comment_user_visual/", { params: param })
        .then((res) => {
          console.log("data==>", res);
          const option = res.data.option;

          this.myChart.setOption(option);
        });
    },
  },
  mounted() {
    const dom = document.querySelector(".chartBarComment");
    const myChart = echarts.init(dom);

    this.myChart = myChart;
    this.draw();
  },
};
</script>
<style lang='scss' scoped>
.chartBarComment {
  height: 350px;
}
</style>